<template>
  <div class="wh100 admin-box">
    <p>用户名：{{ adminInfo.username }}</p>
    <p>昵称：{{ adminInfo.nickname }}</p>

    <p>
      功能权限：<span v-for="(item, index) in permissions" :key="index">{{
        item
      }}</span>
    </p>
    <p>所属部门：</p>

    <p>上次登录IP：{{ adminInfo.lastLoginIp }}</p>

    <p>上次登录时间：{{ adminInfo.lastLoginTime }}</p>

    <p>创建时间：{{ adminInfo.createTime }}</p>

    <p>修改时间：{{ adminInfo.updateTime }}</p>

    <p>
      账号状态：
      <span style="color: #3ad76e" v-if="adminInfo.isDisable == 0">启用</span>
      <span style="color: #e6873a" v-else>禁用</span>
    </p>
  </div>
</template>
<script>
import { getAdminInfo } from "@/api/admin";
export default {
  data() {
    return {
      adminInfo: {},
      permissions: [],
    };
  },
  mounted() {
    this.getAdminInfo();
  },
  methods: {
    async getAdminInfo() {
      let res = await getAdminInfo();
      if (res.code == 200) {
        this.adminInfo = res.data.user;
        res.data.permissions.forEach((item) => {
          if (item == "*") {
            item = "全部";
          }
          this.permissions.push(item);
        });
      }
    },
  },
};
</script>

<style lang="scss" scoped>
.admin-box {
  color: #ffffff;
  font-size: 18px;
}
</style>